home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Utilities / Programming / C Reference Card 2.5 / C Reference Card / C Reference Card.rsrc / TEXT_415_15.txt < prev    next >
Encoding:
Text File  |  1996-06-24  |  18.7 KB  |  740 lines

  1. PROGRAMMING THE MAC : about, compiler, references, sample application
  2. _________________________________________________________________________
  3.  
  4.  
  5. ABOUT THIS SECTION
  6.  
  7. This section does NOT provide a detailed explanation on how to program for the Macintosh.  There are other (and better) sources for this type of information.  What this section DOES provide is a suggested approach for learning how to start programming for the Macintosh and what sort of tools and documentation you'll need based on personal experience.  Also provided is a sample application which can be used as a reference and a starting point for your own applications.  Learning C or C++ is a fairly straightforward experience.  Attempting the tackle the Toolbox (the function calls which make up the MacOS) can be a much more daunting task.  Try to be patient and don't expect to learn everything in one day.
  8.  
  9. You'd think that learning to program the Macintosh (or any graphical environment) would consist of buying one book, start at the beginning, and a few days later finish the book with a thorough knowledge of everything you needed to know to master the Toolbox.  Well, it simply ain't so.  There are literally volumes of reference material from Apple on all of the Managers which comprise the MacOS.  Managers are groups of related functions.  Examples of which are the QuickDraw Manager, TextEdit Manager, Menu Manager, etc.  There are dozens of Managers and THOUSANDS of functions which comprise the Toolbox.  Very few people can expect to master them all.
  10.  
  11.  
  12.  
  13. PURCHASING A COMPILER
  14.  
  15. There are basically two choices for C/C++ compilers for the Macintosh; Think C by Symantec and CodeWarrior by Metrowerks.  Both are similarly priced and both are full-featured compilers.  Think C has been around for longer, but Code Warrior has made major inroads since it's introduction.  Either choice is money well spent.
  16.  
  17.  
  18.  
  19. REFERENCE MATERIAL
  20.  
  21. The following is the minimum recommended reference material you should start out with if you intend on programming for the Macintosh:
  22.  
  23. Inside Macintosh: Overview
  24. Inside Macintosh: Macintosh Toolbox Essentials
  25. Inside Macintosh: Imaging with QuickDraw
  26. Symantec THINK Reference and/or APDA Toolbox Assistant
  27. A good C/C++ book
  28.  
  29. There are currently over two dozen "Inside Macintosh" books available from Apple.  You can easily order these books (as well as your compiler) through APDA (Apple Program Developers Association).  While your at it, consider becoming a member of APDA.  APDA can be reached at 1-800-282-2732 or over the net at http://www.info.apple.com/dev.
  30.  
  31.  
  32.  
  33. A COMPLETE SAMPLE APPLICATION
  34.  
  35. The following is a complete application.  It represents watered-down code in that there is limited error-checking and no support for things like AppleEvents, Scripting, or Balloon Help.  However, it does provide the basic event-loop which almost all Macintosh applications are based on.
  36.  
  37. The sample application consists of two files; starter.cp and resources.r
  38.  
  39.  
  40. /************************* Segment: starter.cp **************************
  41.                      
  42.   All functions and sub-routines are identified with an underscore '_' 
  43.   at the end of the function name.  This hopefully helps to identify
  44.   program functions from Toolbox calls.
  45.                 
  46. */
  47.  
  48. /********** Standard Includes */
  49. #include <Types.h>
  50. #include <Quickdraw.h>
  51. #include <Controls.h>
  52. #include <Desk.h>
  53. #include <Dialogs.h>
  54. #include <DiskInit.h>
  55. #include <Editions.h>
  56. #include <EPPC.h>
  57. #include <Events.h>
  58. #include <Fonts.h>
  59. #include <GestaltEqu.h>
  60. #include <Lists.h>
  61. #include <Menus.h>
  62. #include <OSEvents.h>
  63. #include <TextEdit.h>
  64. #include <ToolUtils.h>
  65. #include <Traps.h>
  66. #include <AppleEvents.h>
  67. #include <Balloons.h>
  68.  
  69. /********** Define Statements */
  70. #define kNilPtr             0L
  71. #define kMoveToFront        (WindowPtr)-1L
  72. #define kLeaveIt            false
  73. #define kRemoveEvents       0
  74. #define kSleep              60L
  75. #define kNilMouseRegion     0L
  76. #define kWaitNextEventTrap  0x60
  77. #define kUnimplementedTrap  0x9F
  78. #define kMinimumSysVersion  0x700  // minimum system version required
  79.  
  80. /********** General */
  81. const short kDragThreshold = 30;
  82. const unsigned char *kNilStr = "\p";
  83. const unsigned char *kFatalErrorStr = "\pFatal Error!";
  84.  
  85. /********** Window definitions */
  86. const short kNewWindow =    400;
  87. const short kWindowLeft =   5;
  88. const short kWindowTop =    45;
  89. const short kWindowOffset = 20;
  90.  
  91. /********** Alerts */
  92. const short kAboutAlert =   400;
  93. const short kErrorAlert =   401;
  94.  
  95. /********** Param Text */
  96. const short kGeneralError = 400;
  97. const short kBadSystem =    401;
  98. const short kNoMenuBarRes = 402;
  99. const short kNoMenuRes =    403;
  100. const short kNoWindowRes =  404;
  101.  
  102. /********** Menu Stuff */
  103. const short kMenuBar =      400;
  104. const short kAppleMenu =    400;
  105. const short kFileMenu =     401;
  106. const short kEditMenu =     402;
  107. const short kAppleAbout =   1;
  108. const short kFileNew =      1;
  109. const short kFileClose =    2;
  110. const short kFileQuit =     3;
  111. const short kEditUndo =     1;
  112. const short kEditCut =      2;
  113. const short kEditCopy =     3;
  114. const short kEditPaste =    4;
  115. const short kEditClear =    6;
  116.  
  117. /********** Structures */
  118. struct SysConfigRec
  119. {
  120.     Boolean hasGestalt;
  121.     Boolean hasWNE;
  122.     Boolean hasColorQD;
  123.     Boolean hasAppleEvents;
  124.     Boolean hasEditionMgr;
  125.     Boolean hasHelpMgr;
  126.  
  127.     long    sysVersion;
  128. };
  129.  
  130. /********** Global Variables */
  131. Boolean             gDone;
  132. EventRecord         gTheEvent;
  133. MenuHandle          gAppleMenu;
  134. MenuHandle          gFileMenu;
  135. MenuHandle          gEditMenu;
  136. Rect                gDragRect;
  137. short               gAppResourceFile;
  138. struct SysConfigRec gSysConfig;
  139. int                 gNewWindowLeft = kWindowLeft;
  140. int                 gNewWindowTop = kWindowTop;
  141.  
  142. /********** Prototypes */
  143. void main( void );
  144. void ToolBoxInit_( void );
  145. static void GetSysConfig_( void );
  146. Boolean TrapAvailable_( short tNumber, TrapType tType );
  147. void MenuBarInit_( void );
  148. void SetUpDragRect_( void );
  149. void HandleEvent_( void );
  150. void DoMouseDown_( void );
  151. void AdjustMenus_( void );
  152. short IsDAWindow_( WindowPtr w );
  153. void DoMenuChoice_( long int menuChoice );
  154. void DoAppleChoice_( int theItem );
  155. void DoFileChoice_( int theItem );
  156. void DoEditChoice_( int theItem );
  157. void DoCreateWindow_( void );
  158. void ErrorHandler_( int stringNum, int quitFlag );
  159.  
  160.  
  161. /********** main */
  162.  
  163. void main( void )
  164. {
  165.     ToolBoxInit_();
  166.     GetSysConfig_();
  167.     MenuBarInit_();
  168.     SetUpDragRect_();
  169.     DoCreateWindow_();
  170.     
  171.     gDone = false;
  172.     while( gDone == false )
  173.         HandleEvent_();
  174. }
  175.  
  176.  
  177. /********** ToolBoxInit */
  178.  
  179. void ToolBoxInit_( void )
  180. {
  181.     // Standard initialization procedure per IM:Overview p4-75
  182.  
  183.     MaxApplZone();
  184.     MoreMasters();
  185.     
  186.     InitGraf( &qd.thePort );
  187.     InitFonts();
  188.     InitWindows();
  189.     InitMenus();
  190.     TEInit();
  191.     InitDialogs( kNilPtr );
  192.     
  193.     FlushEvents( everyEvent, kRemoveEvents );    
  194.     InitCursor();
  195. }
  196.  
  197.  
  198. /********** GetSysConfig */
  199.  
  200. static void GetSysConfig_( void )
  201. {   
  202.     OSErr        ignoreError;
  203.     long         tempLong;
  204.     SysEnvRec    environs;
  205.     short        myBit;
  206.  
  207.     // set app resource fork ID
  208.     gAppResourceFile = CurResFile();
  209.  
  210.     // check to see if Gestalt Manager is supported
  211.     gSysConfig.hasGestalt = TrapAvailable_( _Gestalt, ToolTrap );
  212.     if( !gSysConfig.hasGestalt )
  213.         // something has got to be wrong
  214.         ErrorHandler_( kGeneralError, true );
  215.     else
  216.     {
  217.         // determine system configuration
  218.  
  219.         gSysConfig.hasWNE = TrapAvailable_( _WaitNextEvent, ToolTrap );
  220.         
  221.         ignoreError = Gestalt( gestaltQuickdrawVersion, &tempLong );
  222.         gSysConfig.hasColorQD = ( tempLong != gestaltOriginalQD );
  223.         
  224.         gSysConfig.hasAppleEvents = ( Gestalt( gestaltAppleEventsAttr,
  225.             &tempLong ) == noErr );
  226.  
  227.         gSysConfig.hasEditionMgr = ( Gestalt( gestaltEditionMgrAttr,
  228.             &tempLong ) == noErr );
  229.         if( gSysConfig.hasEditionMgr )
  230.             if( InitEditionPack() != noErr )
  231.                 gSysConfig.hasEditionMgr = false;
  232.                 
  233.         ignoreError = Gestalt( gestaltHelpMgrAttr, &tempLong );
  234.         myBit = gestaltHelpMgrPresent;
  235.         gSysConfig.hasHelpMgr =
  236.             BitTst( &tempLong, 31 - myBit );
  237.             
  238.         gSysConfig.sysVersion = 0.0;
  239.         ignoreError = Gestalt( gestaltSystemVersion, &tempLong );
  240.         gSysConfig.sysVersion = tempLong;
  241.         if( kMinimumSysVersion > gSysConfig.sysVersion )
  242.             ErrorHandler_( kBadSystem, true );
  243.     }
  244. }
  245.  
  246.  
  247. /********** TrapAvailable */
  248.  
  249. Boolean TrapAvailable_( short tNumber, TrapType tType )
  250. {
  251.     return( NGetTrapAddress( tNumber, tType ) 
  252.     != GetTrapAddress( _Unimplemented ) );
  253. }
  254.  
  255.  
  256. /********** MenuBarInit */
  257.  
  258. void MenuBarInit_( void )
  259. {
  260.     Handle  myMenuBar;
  261.  
  262.     if( ( myMenuBar = GetNewMBar( kMenuBar ) ) == kNilPtr )
  263.         ErrorHandler_( kNoMenuBarRes, true );
  264.     SetMenuBar( myMenuBar );
  265.     
  266.     gAppleMenu = GetMHandle( kAppleMenu );
  267.     gFileMenu = GetMHandle( kFileMenu );
  268.     gEditMenu = GetMHandle( kEditMenu );
  269.     if( gAppleMenu == kNilPtr || gFileMenu == kNilPtr || 
  270.       gEditMenu == kNilPtr ) ErrorHandler_( kNoMenuRes, true );
  271.     AddResMenu( gAppleMenu, 'DRVR' );
  272.     DrawMenuBar();
  273. }
  274.  
  275.  
  276. /********** SetUpDragRect */
  277.  
  278. void SetUpDragRect_( void )
  279. {
  280.     gDragRect = qd.screenBits.bounds;
  281.     gDragRect.left += kDragThreshold;
  282.     gDragRect.right -= kDragThreshold;
  283.     gDragRect.bottom -= kDragThreshold;
  284. }
  285.  
  286.  
  287. /********** HandleEvent */
  288.  
  289. void HandleEvent_( void )
  290. {
  291.     char      theChar;
  292.     GrafPtr   oldPort;
  293.     WindowPtr w;
  294.     
  295.     if( gSysConfig.hasWNE )
  296.         WaitNextEvent( everyEvent, &gTheEvent, kSleep, kNilMouseRegion );
  297.     else
  298.     {
  299.         SystemTask();
  300.         GetNextEvent( everyEvent, &gTheEvent );
  301.     }
  302.  
  303.     switch( gTheEvent.what )
  304.     {
  305.         case mouseDown: 
  306.             DoMouseDown_();
  307.             break;
  308.         case mouseUp:
  309.             // this application doesn't use mouseUp events
  310.             break;
  311.         case keyDown:
  312.         case autoKey:
  313.             theChar = gTheEvent.message & charCodeMask;
  314.             if(( gTheEvent.modifiers & cmdKey ) != 0)
  315.             {
  316.                 AdjustMenus_(); 
  317.                 DoMenuChoice_( MenuKey( theChar ) );
  318.             }
  319.             else
  320.             {
  321.                 /* Handle text from keyboard */
  322.             }
  323.             break;
  324.         case updateEvt:
  325.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  326.             {
  327.                 w = (WindowPtr)gTheEvent.message;
  328.                 GetPort( &oldPort );
  329.                 SetPort( w );
  330.                 BeginUpdate( w );
  331.  
  332.                     // perform and update/drawing here
  333.  
  334.                 EndUpdate( w );
  335.                 SetPort( oldPort );
  336.             }
  337.             break;
  338.         case diskEvt:
  339.             // most applications don't need to worry about diskEvt's
  340.              break;
  341.         case activateEvt:
  342.             // this application doesn't need to worry about activateEvt's
  343.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  344.             {
  345.                 if( gTheEvent.modifiers & activeFlag )
  346.                 {
  347.                     /* Handle activate event. */
  348.                 }
  349.                 else
  350.                 {
  351.                     /* Handle deactivate event. */
  352.                 }
  353.             }
  354.             break;
  355.         case osEvt:
  356.             // this application doesn't support operating sys events
  357.             break;
  358.         case nullEvent:
  359.             // ignore
  360.             break;
  361.      /*
  362.         case kHighLevelEvent:
  363.             // this application doesn't support high level events
  364.             // need to #include <Events.h> to define kHighLevelEvent
  365.             break;
  366.      */
  367.     }
  368. }
  369.  
  370.  
  371. /********** DoMouseDown */
  372.  
  373. void DoMouseDown_( void )
  374. {
  375.     WindowPtr   w;
  376.     short int   thePart;
  377.     long int    menuChoice;    
  378.     Point       theLocation;
  379.     
  380.     thePart = FindWindow( gTheEvent.where, &w );
  381.     switch( thePart )
  382.     {
  383.         case inMenuBar:
  384.             AdjustMenus_();
  385.             menuChoice = MenuSelect( gTheEvent.where );
  386.             DoMenuChoice_( menuChoice );
  387.             break;
  388.         case inSysWindow: 
  389.             SystemClick( &gTheEvent, w );
  390.             break;
  391.         case inContent:
  392.             if( w != FrontWindow() )
  393.                 SelectWindow( w );
  394.             else if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  395.                 /* Handle click in window content */ ;
  396.             break;
  397.         case inDrag: 
  398.             DragWindow( w, gTheEvent.where, &gDragRect );
  399.             break;
  400.         case inGrow:
  401.             // not used in this application
  402.             break;
  403.         case inGoAway:
  404.             theLocation = gTheEvent.where;
  405.             GlobalToLocal( &theLocation );
  406.             if( TrackGoAway( w, theLocation ) )
  407.                 DisposeWindow( w );
  408.             break;
  409.         case inZoomIn:
  410.         case inZoomOut:
  411.             // not used in this application
  412.             break;
  413.     }
  414. }
  415.  
  416.  
  417. /********** AdjustMenus */
  418.  
  419. void AdjustMenus_( void )
  420. {
  421.     WindowPtr w;
  422.  
  423.     if(IsDAWindow_( FrontWindow() ) )
  424.     {
  425.         EnableItem( gEditMenu, kEditUndo );
  426.         EnableItem( gEditMenu, kEditCut );
  427.         EnableItem( gEditMenu, kEditCopy );
  428.         EnableItem( gEditMenu, kEditPaste );
  429.         EnableItem( gEditMenu, kEditClear );
  430.     }
  431.     else
  432.     {
  433.         DisableItem( gEditMenu, kEditUndo );
  434.         DisableItem( gEditMenu, kEditCut );
  435.         DisableItem( gEditMenu, kEditCopy );
  436.         DisableItem( gEditMenu, kEditPaste );
  437.         DisableItem( gEditMenu, kEditClear );
  438.     }
  439.         
  440.     if( ( w = FrontWindow() ) == kNilPtr )
  441.         DisableItem( gFileMenu, kFileClose );
  442.     else
  443.         EnableItem( gFileMenu, kFileClose );
  444. }
  445.  
  446.  
  447. /********** IsDAWindow */
  448.  
  449. short IsDAWindow_( WindowPtr w )
  450. {
  451.     if( w == kNilPtr )
  452.         return( false );
  453.     else /* DA windows have negative windowKinds */
  454.         return( ( (WindowPeek)w )->windowKind < 0 );
  455. }
  456.  
  457.  
  458. /********** DoMenuChoice */
  459.  
  460. void DoMenuChoice_( long int menuChoice )
  461. {
  462.     int    theMenu;
  463.     int    theItem;
  464.     
  465.     if( menuChoice != 0 )
  466.     {
  467.         theMenu = HiWord( menuChoice );
  468.         theItem = LoWord( menuChoice );
  469.         switch( theMenu )
  470.         {
  471.             case kAppleMenu :
  472.                 DoAppleChoice_( theItem );
  473.                 break;
  474.             case kFileMenu :
  475.                 DoFileChoice_( theItem );
  476.                 break;
  477.             case kEditMenu :
  478.                 DoEditChoice_( theItem );
  479.                 break;
  480.         }
  481.         HiliteMenu( 0 );
  482.     }
  483. }
  484.  
  485.  
  486. /********** DoAppleChoice */
  487.  
  488. void DoAppleChoice_( int theItem )
  489. {
  490.     Str255  accName;
  491.     int     accNumber;
  492.     
  493.     switch( theItem )
  494.     {
  495.         case kAppleAbout : 
  496.             NoteAlert( kAboutAlert, kNilPtr );
  497.             break;
  498.         default :
  499.             GetItem( gAppleMenu, theItem, accName );
  500.             accNumber = OpenDeskAcc( accName );
  501.             break;
  502.     }
  503. }
  504.  
  505.  
  506. /********** DoFileChoice */
  507.  
  508. void DoFileChoice_( int theItem )
  509. {
  510.     WindowPtr   w;
  511.  
  512.     switch( theItem )
  513.     {
  514.         case kFileNew :
  515.             DoCreateWindow_();
  516.             break;
  517.         case kFileClose :
  518.             if( ( w = FrontWindow() ) != kNilPtr )
  519.                 DisposeWindow( w );
  520.             break;
  521.         case kFileQuit :
  522.             gDone = TRUE;
  523.             break;
  524.     }
  525. }
  526.  
  527.  
  528. /********** DoEditChoice */
  529.  
  530. void DoEditChoice_( int theItem )
  531. {
  532.     if( SystemEdit( theItem - 1 ) == 0 )
  533.     {
  534.         /* Add Edit menu switch statement here */
  535.     }
  536. }
  537.  
  538.  
  539. /********** DoCreateWindow */
  540.  
  541. void DoCreateWindow_( void )
  542. {
  543.     WindowPtr    w;
  544.     
  545.     w = GetNewWindow( kNewWindow, kNilPtr, kMoveToFront );
  546.     if(((qd.screenBits.bounds.right - gNewWindowLeft) < kDragThreshold) ||
  547.         ((qd.screenBits.bounds.bottom - gNewWindowTop) < kDragThreshold))
  548.     {
  549.         gNewWindowLeft = kWindowLeft;
  550.         gNewWindowTop = kWindowTop;
  551.     }
  552.     MoveWindow( w, gNewWindowLeft, gNewWindowTop, kLeaveIt );
  553.     gNewWindowLeft += kWindowOffset;
  554.     gNewWindowTop += kWindowOffset;
  555.     ShowWindow( w );
  556. }
  557.  
  558.  
  559. /********** ErrorHandler */
  560.  
  561. void ErrorHandler_( int stringNum, int quitFlag )
  562. {
  563.     StringHandle   errorStringH;
  564.     
  565.     if( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
  566.         ParamText( kFatalErrorStr, kNilStr, kNilStr, kNilStr );
  567.     else
  568.     {
  569.         HLock( (Handle)errorStringH );
  570.         ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
  571.         HUnlock( (Handle)errorStringH );
  572.     }
  573.     StopAlert( kErrorAlert, kNilPtr );
  574.     if( quitFlag )
  575.         ExitToShell();
  576. }
  577.  
  578.  
  579. /************************* Segment: resources.r ************************/
  580.  
  581. #include <Types.r>
  582.  
  583. resource 'WIND' (400, "Main WIND") {
  584.     {45, 5, 205, 181},
  585.     noGrowDocProc,
  586.     invisible,
  587.     goAway,
  588.     0x0,
  589.     "Window"
  590. };
  591.  
  592. resource 'MENU' (401, "File") {
  593.     401,
  594.     textMenuProc,
  595.     allEnabled,
  596.     enabled,
  597.     "File",
  598.     {    /* array: 3 elements */
  599.         /* [1] */
  600.         "New", noIcon, "N", noMark, plain,
  601.         /* [2] */
  602.         "Close", noIcon, "W", noMark, plain,
  603.         /* [3] */
  604.         "Quit", noIcon, "Q", noMark, plain
  605.     }
  606. };
  607.  
  608. resource 'MENU' (400, "Apple") {
  609.     400,
  610.     textMenuProc,
  611.     0x7FFFFFFD,
  612.     enabled,
  613.     apple,
  614.     {    /* array: 2 elements */
  615.         /* [1] */
  616.         "About...", noIcon, noKey, noMark, plain,
  617.         /* [2] */
  618.         "-", noIcon, noKey, noMark, 1
  619.     }
  620. };
  621.  
  622. resource 'MENU' (402, "Edit", preload) {
  623.     402,
  624.     textMenuProc,
  625.     0x0,
  626.     enabled,
  627.     "Edit",
  628.     {    /* array: 6 elements */
  629.         /* [1] */
  630.         "Undo", noIcon, "Z", noMark, plain,
  631.         /* [2] */
  632.         "-", noIcon, noKey, noMark, plain,
  633.         /* [3] */
  634.         "Cut", noIcon, "X", noMark, plain,
  635.         /* [4] */
  636.         "Copy", noIcon, "C", noMark, plain,
  637.         /* [5] */
  638.         "Paste", noIcon, "V", noMark, plain,
  639.         /* [6] */
  640.         "Clear", noIcon, noKey, noMark, plain
  641.     }
  642. };
  643.  
  644. resource 'MBAR' (400, "Main MBAR") {
  645.     {    /* array MenuArray: 3 elements */
  646.         /* [1] */
  647.         400,
  648.         /* [2] */
  649.         401,
  650.         /* [3] */
  651.         402
  652.     }
  653. };
  654.  
  655. resource 'DITL' (400, "About") {
  656.     {    /* array DITLarray: 2 elements */
  657.         /* [1] */
  658.         {71, 117, 91, 177},
  659.         Button {
  660.             enabled,
  661.             "OK"
  662.         },
  663.         /* [2] */
  664.         {7, 70, 61, 280},
  665.         StaticText {
  666.             enabled,
  667.             "Starter Application - a place to start y"
  668.             "our Macintosh program."
  669.         }
  670.     }
  671. };
  672.  
  673. resource 'DITL' (401, "Fatal Error") {
  674.     {    /* array DITLarray: 2 elements */
  675.         /* [1] */
  676.         {86, 117, 106, 177},
  677.         Button {
  678.             enabled,
  679.             "Exit"
  680.         },
  681.         /* [2] */
  682.         {5, 67, 71, 283},
  683.         StaticText {
  684.             enabled,
  685.             "Fatal error:  ^0"
  686.         }
  687.     }
  688. };
  689.  
  690. resource 'ALRT' (400, "About") {
  691.     {40, 40, 142, 332},
  692.     400,
  693.     {    /* array: 4 elements */
  694.         /* [1] */
  695.         OK, visible, silent,
  696.         /* [2] */
  697.         OK, visible, silent,
  698.         /* [3] */
  699.         OK, visible, silent,
  700.         /* [4] */
  701.         OK, visible, silent
  702.     }
  703. };
  704.  
  705. resource 'ALRT' (401, "Fatal Error") {
  706.     {40, 40, 156, 332},
  707.     401,
  708.     {    /* array: 4 elements */
  709.         /* [1] */
  710.         OK, visible, sound1,
  711.         /* [2] */
  712.         OK, visible, sound1,
  713.         /* [3] */
  714.         OK, visible, sound1,
  715.         /* [4] */
  716.         OK, visible, sound1
  717.     }
  718. };
  719.  
  720. resource 'STR ' (400, "General Error") {
  721.     "An unrecoverable error occured!"
  722. };
  723.  
  724. resource 'STR ' (401, "System Error") {
  725.     "Need to upgrade to System 7!"
  726. };
  727.  
  728. resource 'STR ' (402, "MENUBAR Error") {
  729.     "Couldn't load the MENU Bar resource!"
  730. };
  731.  
  732. resource 'STR ' (403, "MENU Error") {
  733.     "Couldn't load a MENU resource!"
  734. };
  735.  
  736. resource 'STR ' (404, "WIND Error") {
  737.     "Couldn't load a WIND resource!"
  738. };
  739.  
  740. // End of File